package main;

import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.AfterClass;

public class TestRockPaperScissors {
	RockPaperScissors rps;
	
  @BeforeClass
  public void setUpClass() {
	  rps=new RockPaperScissors();
  }

  @AfterClass
  public void tearDownClass() {
	  rps=null;
  }

  @DataProvider(name = "gagnant")
  public Object[][] creategagnant() {
    return new Object[][] { 
       { RPSEnum.ROCK, RPSEnum.SCISSORS },
       { RPSEnum.PAPER, RPSEnum.ROCK},
       { RPSEnum.SCISSORS, RPSEnum.PAPER}};
  }
  
  @DataProvider(name = "perdant")
  public Object[][] createperdant() {
    return new Object[][] { 
       { RPSEnum.ROCK, RPSEnum.PAPER },
       { RPSEnum.PAPER, RPSEnum.SCISSORS},
       { RPSEnum.SCISSORS, RPSEnum.ROCK}};
  }
  
  @DataProvider(name = "egalite")
  public Object[][] createegualite() {
    return new Object[][] { 
       { RPSEnum.ROCK, RPSEnum.ROCK },
       { RPSEnum.PAPER, RPSEnum.PAPER},
       { RPSEnum.SCISSORS, RPSEnum.SCISSORS}};
  }
  

  
  @Test(dataProvider="gagnant")
  public void testWinPlay(RPSEnum p1, RPSEnum p2) {
    assert Result.WIN.equals(rps.play(p1,p2));
  }
  
  @Test(dataProvider="egalite")
  public void testTiePlay(RPSEnum p1, RPSEnum p2)
  {
	  assert Result.TIE.equals(rps.play(p1, p2));
  }
  
  
  @Test(dataProvider="perdant")
  public void testLostPlay(RPSEnum p1, RPSEnum p2)
  {
	  assert Result.LOST.equals(rps.play(p1, p2));
  }
  
  
  /*
   * Tests sans dataProvider
   * 
  @Test
  public void testWinPlay() {
    assert Result.WIN.equals(rps.play(RPSEnum.PAPER, RPSEnum.ROCK));
  }
  
  @Test
  public void testTiePlay()
  {
	  assert Result.TIE.equals(rps.play(RPSEnum.PAPER, RPSEnum.PAPER));
  }
  
  @Test
  public void testLostPlay()
  {
	  assert Result.LOST.equals(rps.play(RPSEnum.ROCK, RPSEnum.PAPER));
  }
  */
  
  
}
